package com.xmwzw.catpu;

import android.databinding.DataBindingUtil;
import android.databinding.ViewDataBinding;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.widget.Toast;

/**
 * @author : wangzw
 * @date : 20-3-31上午9:48
 * @desc :
 */
public abstract class BaseActivity extends FragmentActivity {

    protected ViewDataBinding mDataBinding;

    public <V extends ViewDataBinding> V getBaseViewBinding() {
        return (V) mDataBinding;
    }

    public abstract int getLayoutId();

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mDataBinding = DataBindingUtil.setContentView(this, getLayoutId());
    }


    public void showToast(String message) {
        Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
    }
}
